home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / IFC_112 / netscape / util / Encoder.java < prev    next >
Encoding:
Text File  |  1999-05-28  |  4.5 KB  |  129 lines  |  [TEXT/CWIE]

  1. // Encoder.java
  2. // By Ned Etcode
  3. // Copyright 1995, 1996, 1997 Netscape Communications Corp.  All rights reserved.
  4.  
  5. package netscape.util;
  6.  
  7. /** The Encoder interface describes the API through which objects encode
  8.   * their essential state as a set of key-value pairs. Archiver implements
  9.   * this API to encode the state of a graph of objects into an Archive.
  10.   *
  11.   * @see Codable
  12.   * @see Archiver
  13.   * @see Archive
  14.   */
  15. public interface Encoder {
  16.     /** Encodes the boolean <b>value</b>, associating it with the string
  17.       * <b>key</b>.
  18.       */
  19.     public void encodeBoolean(String key, boolean value)
  20.         throws CodingException;
  21.  
  22.     /** Encodes the boolean array <b>value</b>, associating it with the string
  23.       * <b>key</b>.
  24.       */
  25.     public void encodeBooleanArray(String key, boolean value[], int offset,
  26.         int length) throws CodingException;
  27.  
  28.     /** Encodes the character <b>value</b>, associating it with the string
  29.       * <b>key</b>.
  30.       */
  31.     public void encodeChar(String key, char value) throws CodingException;
  32.  
  33.     /** Encodes the character array <b>value</b>, associating it with the
  34.       * string <b>key</b>.
  35.       */
  36.     public void encodeCharArray(String key, char value[], int offset,
  37.         int length) throws CodingException;
  38.  
  39.     /** Encodes the byte <b>value</b>, associating it with the string
  40.       * <b>key</b>.
  41.       */
  42.     public void encodeByte(String key, byte value) throws CodingException;
  43.  
  44.     /** Encodes the byte array <b>value</b>, associating it with the string
  45.       * <b>key</b>.
  46.       */
  47.     public void encodeByteArray(String key, byte value[], int offset,
  48.         int length) throws CodingException;
  49.  
  50.     /** Encodes the short <b>value</b>, associating it with the string
  51.       * <b>key</b>.
  52.       */
  53.     public void encodeShort(String key, short value) throws CodingException;
  54.  
  55.     /** Encodes the short array <b>value</b>, associating it with the string
  56.       * <b>key</b>.
  57.       */
  58.     public void encodeShortArray(String key, short value[], int offset,
  59.         int length) throws CodingException;
  60.  
  61.     /** Encodes the integer <b>value</b>, associating it with the string
  62.       * <b>key</b>.
  63.       */
  64.     public void encodeInt(String key, int value) throws CodingException;
  65.  
  66.     /** Encodes the integer array <b>value</b>, associating it with the string
  67.       * <b>key</b>.
  68.       */
  69.     public void encodeIntArray(String key, int value[], int offset,
  70.         int length) throws CodingException;
  71.  
  72.     /** Encodes the long <b>value</b>, associating it with the string
  73.       * <b>key</b>.
  74.       */
  75.     public void encodeLong(String key, long value) throws CodingException;
  76.  
  77.     /** Encodes the long array <b>value</b>, associating it with the string
  78.       * <b>key</b>.
  79.       */
  80.     public void encodeLongArray(String key, long value[], int offset,
  81.         int length) throws CodingException;
  82.  
  83.     /** Encodes the float <b>value</b>, associating it with the string
  84.       * <b>key</b>.
  85.       */
  86.     public void encodeFloat(String key, float value) throws CodingException;
  87.  
  88.     /** Encodes the float array <b>value</b>, associating it with the string
  89.       * <b>key</b>.
  90.       */
  91.     public void encodeFloatArray(String key, float value[], int offset,
  92.         int length) throws CodingException;
  93.  
  94.     /** Encodes the double <b>value</b>, associating it with the string
  95.       * <b>key</b>.
  96.       */
  97.     public void encodeDouble(String key, double value) throws CodingException;
  98.  
  99.     /** Encodes the double array <b>value</b>, associating it with the string
  100.       * <b>key</b>.
  101.       */
  102.     public void encodeDoubleArray(String key, double value[], int offset,
  103.         int length) throws CodingException;
  104.  
  105.     /** Encodes the string <b>value</b>, associating it with the string
  106.       * <b>key</b>.
  107.       */
  108.     public void encodeString(String key, String value) throws CodingException;
  109.  
  110.     /** Encodes the string array <b>value</b>, associating it with the string
  111.       * <b>key</b>.
  112.       */
  113.     public void encodeStringArray(String key, String value[], int offset,
  114.         int length) throws CodingException;
  115.  
  116.     /** Encodes a reference to another Codable object. If multiple objects
  117.       * reference the same object and each passes it to <b>encodeObject()</b>,
  118.       * only one copy of that object is actually encoded.
  119.       */
  120.     public void encodeObject(String key, Object value)
  121.         throws CodingException;
  122.  
  123.     /** Encodes an array of Codable objects. The reference to the array is
  124.       * not shared, but references to the objects in the array are.
  125.       */
  126.     public void encodeObjectArray(String key, Object value[], int offset,
  127.         int length) throws CodingException;
  128. }
  129.